package com.sky.mapper;

import com.sky.entity.SetmealDish;
import org.apache.ibatis.annotations.Delete;
import org.apache.ibatis.annotations.Mapper;
import org.apache.ibatis.annotations.Select;

import java.util.List;

@Mapper
public interface SetmealDishMapper {

    /**
     * @MethodName: getSetmealIdDishIds
     * @Author 冰白寒祭
     * @Description: 根据菜品id查询对应的套餐id
     * @Date: 2023/9/1 15:28
     * @param: List<Long> dishIds
     * @return: List<Long>
     */

    List<Long> getSetmealIdDishIds(List<Long> dishIds);

    /**
     * @MethodName: insertBatch
     * @Author 冰白寒祭
     * @Description: 批量保存套餐和菜品的关联关系
     * @Date: 2023-09-02 09:19:25
     * @param: List<SetmealDish> setmealDishes
    */
    void insertBatch(List<SetmealDish> setmealDishes);

    /**
     * @MethodName: deleteBySetmealId
     * @Author 冰白寒祭
     * @Description: 根据套餐id删除套餐和菜品的关联关系
     * @Date: 2023-09-02 10:04:04
     * @param: Long id
    */
    @Delete("delete from setmeal_dish where setmeal_id = #{id}")
    void deleteBySetmealId(Long id);


    /**
     * @MethodName: getBySetmealId
     * @Author 冰白寒祭
     * @Description: 根据套餐id查询套餐和菜品的关联关系
     * @Date: 2023-09-02 10:25:05
     * @param: Long id
    * @return: List<SetmealDish>
    */
    @Select("select * from setmeal_dish where setmeal_id = #{setmealId}")
    List<SetmealDish> getBySetmealId(Long id);

}
